﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using CetWin.Phone.Entity;
using CetWin.ViewModels;
using Phone.Framework;
namespace CetWin.Views
{
    public partial class HistoriesView : PhoneApplicationPage
    {
        public HistoriesView()
        {
            InitializeComponent();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var element = sender as FrameworkElement;
            var menu = element.FindAncestor<ContextMenu>();
            if(menu!=null)
            {
                if (menu.Owner != null)
                {
                    var ee = menu.Owner as FrameworkElement;
                    MessageBox.Show(ee.Tag.ToString());
                }
            }
        }

        private void menu_Element_Loaded(object sender, RoutedEventArgs e)
        {
            var menu = sender as ContextMenu;
          
            if (menu != null)
            {
                if (menu.Owner != null)
                {
                    var ee = menu.Owner as FrameworkElement;
                    Caliburn.Micro.Action.SetTargetWithoutContext(menu, ee.Tag);
                  //  MessageBox.Show(ee.Tag.ToString());
                }
            }
        }
    }
}